#include <iostream>
#include <fmt/core.h>


#define VARNAME(x) #x

using namespace fmt;
using std::cout;

template <class T>
class Person
{
public:
    Person(T, T);
    T getYear() const;
    T getMoney() const;
    void setYear(T);
    void setMoney(T);
private:
    T year;
    T money;
};

int main()
{
    Person<int> Tom(10, 1000);
    cout << format("{} is {} years old, he has {} dollars\n", VARNAME(Tom), Tom.getYear(), Tom.getMoney());
    Tom.setYear(16);
    cout << format("{} is {} years old, he has {} dollars\n", VARNAME(Tom), Tom.getYear(), Tom.getMoney());

    Person<double> Mary(15.5, 1561.5545);
    cout << format("{} is {} years old, she has {} dollars\n", VARNAME(Mary), Mary.getYear(), Mary.getMoney());
    Mary.setMoney(1500);
    cout << format("{} is {} years old, she has {} dollars\n", VARNAME(Mary), Mary.getYear(), Mary.getMoney());

    return 0;
}

template <class T>
Person<T>::Person(T x, T y) : year(x), money(y)
{}

template <class T>
T Person<T>::getYear() const
{
    return year;
}

template <class T>
T Person<T>::getMoney() const
{
    return money;
}

template <class T>
void Person<T>::setMoney(T newMoney)
{
    money = newMoney;
}
 
template <class T>
void Person<T>::setYear(T newYear)
{
    year = newYear;
}